import storage from "@/utils/storage";
import { sendChat, newChat } from "./chatrequest";
import SocketsXinghuo from "./chatxinghuo";
export const sendAi = () => {
  const chatId = ref(+storage.get("chatId", false)); // 会话id
  const idSend = ref(false); // 是否正在发送中
  const xinghuo = new SocketsXinghuo();
  const sendAiMessage = (
    str: string,
  ): Promise<AiDataFace> => {
    idSend.value = true;
    return new Promise(async (resolve, reject) => {
      console.log("当前正在发送");
      xinghuo.send(str).then((text) => {
        resolve({
          type:'xinghuo',
          msg:text
        });
      });
    });
  };
  return { sendAiMessage, idSend };
};
